﻿-- =============================================
-- System Name:    Pre-Contract
-- Component:      Create new table named problemlvassignment
-- Created By:     Leo Ren (leoren@wicresoft.com)
-- Created Date:   2011-5-31
-- =============================================
/****** Object:  Table [dbo].[ProblemLVAssignment]    Script Date: 05/31/2011 09:39:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ProblemLVAssignment]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ProblemLVAssignment](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[ProblemLV1ID] [int] NULL,
	[ProblemLV2ID] [int] NULL,
 CONSTRAINT [PK_ProblemLVAssignment] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[ProblemLVAssignment] ON
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (1, 45, 60)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (2, 45, 61)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (3, 45, 62)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (4, 45, 63)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (5, 45, 64)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (6, 45, 65)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (7, 45, 66)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (8, 46, 67)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (9, 46, 68)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (10, 46, 69)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (11, 46, 70)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (12, 47, 71)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (13, 47, 72)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (14, 47, 73)
INSERT [dbo].[ProblemLVAssignment] ([ID], [ProblemLV1ID], [ProblemLV2ID]) VALUES (15, 47, 74)
SET IDENTITY_INSERT [dbo].[ProblemLVAssignment] OFF
/****** Object:  ForeignKey [FK_ProblemLVAssignment_DicItem_ProblemLV1]    Script Date: 05/31/2011 09:39:13 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_ProblemLVAssignment_DicItem_ProblemLV1]') AND parent_object_id = OBJECT_ID(N'[dbo].[ProblemLVAssignment]'))
ALTER TABLE [dbo].[ProblemLVAssignment]  WITH CHECK ADD  CONSTRAINT [FK_ProblemLVAssignment_DicItem_ProblemLV1] FOREIGN KEY([ProblemLV1ID])
REFERENCES [dbo].[DicItem] ([DicItemID])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_ProblemLVAssignment_DicItem_ProblemLV1]') AND parent_object_id = OBJECT_ID(N'[dbo].[ProblemLVAssignment]'))
ALTER TABLE [dbo].[ProblemLVAssignment] CHECK CONSTRAINT [FK_ProblemLVAssignment_DicItem_ProblemLV1]
GO
/****** Object:  ForeignKey [FK_ProblemLVAssignment_DicItem_ProblemLV2]    Script Date: 05/31/2011 09:39:13 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_ProblemLVAssignment_DicItem_ProblemLV2]') AND parent_object_id = OBJECT_ID(N'[dbo].[ProblemLVAssignment]'))
ALTER TABLE [dbo].[ProblemLVAssignment]  WITH CHECK ADD  CONSTRAINT [FK_ProblemLVAssignment_DicItem_ProblemLV2] FOREIGN KEY([ProblemLV2ID])
REFERENCES [dbo].[DicItem] ([DicItemID])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_ProblemLVAssignment_DicItem_ProblemLV2]') AND parent_object_id = OBJECT_ID(N'[dbo].[ProblemLVAssignment]'))
ALTER TABLE [dbo].[ProblemLVAssignment] CHECK CONSTRAINT [FK_ProblemLVAssignment_DicItem_ProblemLV2]
GO
